package com.sample.snl.frontend.LexicalAnalysis;

import java.io.IOException;

public class InCommentState extends State {
    Automaton automaton;

    public InCommentState(Automaton a) {
        this.automaton = a;
    }

    @Override
    void HandleCharacter(int ch) throws IOException {
        automaton.stringBuilder.deleteCharAt(automaton.stringBuilder.length() - 1);
        while (ch != -1 && ch != '}') {
            ch = automaton.getChar();
        }
        automaton.setState(automaton.StartState);
        if (ch != '}') {
            //LexicalAnalyser.LOG.trace("Missing expected }");
            automaton.setState(automaton.ErrorState);
        }
    }
}
